package com.grandtech.insurance.common.bean;


import com.grandtech.insurance.common.utils.trans.SimpleMap;

import java.io.Serializable;

public abstract class Carries implements Serializable {

    SimpleMap<String, Object> carriesExtend;


    /**
     * ****************************************复制操作 key:表名，val:feature********************************
     * ****************************************复制操作 key:表名，val:feature********************************
     */
    public Carries createCarryExtent() {
        if (carriesExtend == null) carriesExtend = new SimpleMap<>();
        Integer len = carriesExtend.size() + 1;
        carriesExtend.push(len.toString(), null);
        return this;
    }

    public Carries addCarryExtentItem(String key, Object obj) {
        if (carriesExtend == null) return this;
        Integer len = carriesExtend.size();
        if (len == 0) return this;
        Object carryItemObj = carriesExtend.get(len.toString());
        SimpleMap<String, Object> carryItem;
        if (carryItemObj == null) {
            carryItem = new SimpleMap<>();
        } else {
            carryItem = SimpleMap.fromJson((String) carriesExtend.get(len.toString()));
        }
        carryItem.push(key, obj);
        carriesExtend.push(len.toString(), carryItem.toJson());
        return this;
    }

    /**
     * ****************************************复制操作 key:表名，val:feature********************************
     * ****************************************复制操作 key:表名，val:feature********************************
     */

    public SimpleMap<String, Object> getCarriesExtend() {
        return carriesExtend;
    }

    public void setCarriesExtend(SimpleMap<String, Object> carriesExtend) {
        this.carriesExtend = carriesExtend;
    }
}
